<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="utf-8" />
<title>device-pixel-ratio of media queries</title>
<meta name="description" content="CSS3参考手册之: device-pixel-ratio of media queries" />
<meta name="keywords" content="device-pixel-ratio of media queries, css3, css3参考手册" />
<meta name="author" content="Joy Du(飘零雾雨), dooyoe@gmail.com, www.doyoe.com" />
<meta name="robots" content="all" />
<!--[if lte IE 8]>
<script src="../../js/html5.js"></script>
<![endif]-->
<link rel="stylesheet" href="../../skin/article.css" />
</head>
<body>
<nav id="guide" class="g-mod">
	<div class="from">
		<a href="http://css.doyoe.com/" target="_blank">CSS3参考手册</a>
		<span>&#187;</span>
		<a href="../index.htm">属性列表</a>
		<span>&#187;</span>
		<a href="index.htm" id="category" rel="properties/media-queries" name="device-pixel-ratio">媒体查询属性</a>
		<span>&#187;</span>
	</div>
	<div class="to">
		<span class="label">相关内容：</span>
		<div class="g-combobox g-transition">
			<a href="?" class="g-transition target">
				<strong>其它媒体查询属性</strong>
				<span>选择其它项<!--[if lte IE 7]><ins>IE7 and earlier, Get to die</ins><![endif]--></span>
			</a>
			<div class="g-transition list">
				<ul>
					<!-- 插入快速分类导航 -->
				</ul>
			</div>
		</div>
	</div>
</nav>
<header id="hd">
	<section id="title" class="g-mod">
		<h1 class="tit">Media Queries: device-pixel-ratio</h1>
		<ul class="info">
			<li><strong>版本：CSS3</strong></li>
			<li>2018.5.9</li>
		</ul>
		<!-- 插入浏览器信息 -->
	</section>
</header>
<section id="bd">
	<section id="syntax" class="g-mod g-attr">
		<h2 class="tit">语法：</h2>
		<div class="cont">
			<p><strong>device-pixel-ratio</strong>：<a href="../../values/numeric/number.htm">&lt;number&gt;</a></p>
			<p><strong>接受min/max前缀</strong>：是</p>
		</div>
	</section>
	<section id="value" class="g-mod g-attr">
		<h2 class="tit">取值：</h2>
		<div class="cont">
			<dl>
				<dt><a href="../../values/numeric/number.htm">&lt;number&gt;</a>：</dt>
				<dd>用以定义设备屏幕的像素密度。不允许负值</dd>
			</dl>
		</div>
	</section>
	<section id="intro" class="g-mod g-attr">
		<h2 class="tit">说明：</h2>
		<div class="cont">
			<strong>定义设备屏幕的像素密度（即屏幕质量）。</strong>
			<ul>
				<li>本特性为非标准特性，与<a href="resolution.htm" class="g-property">resolution</a>特性能力相同，用来定义设备屏幕的质量。</li>
				<li>
					<p>需要注意的是，本特性接受的值是 <a href="../../values/numeric/number.htm">&lt;number&gt;</a>，不需要单位（但相当于使用了隐式的 <a href="dppx.htm">dppx</a> 单位）；而<a href="resolution.htm" class="g-property">resolution</a>接受的值是 <a href="../../values/resolution/resolution.htm">&lt;resolution&gt;</a>，单位可以是 <a href="dpi.htm">dpi</a>, <a href="dpcm.htm">dpcm</a> 和 <a href="dppx.htm">dppx</a>。</p>
					<div class="gquote">
						<p class="gquote-tit"><strong>下述两种定义效果等同：</strong></p>
						<blockquote class="gquote-cont"><code><xmp>@media (-webkit-max-device-pixel-ratio: 1.49) { … }
@media (max-resolution: 1.49dppx) { … }</xmp></code></blockquote>
					</div>
				</li>
				<li>
					<p>本特性接受<code class="g-code">min</code>和<code class="g-code">max</code>前缀，因此可以派生出<code class="g-property">min-device-pixel-ratio</code>和<code class="g-property">max-device-pixel-ratio</code>两个媒体特性。</p>
					<div class="gquote">
						<p class="gquote-tit"><strong>简单列举几个应用示例：</strong></p>
						<blockquote class="gquote-cont"><code><xmp>@media screen and (-webkit-device-pixel-ratio){ … }
@import url(example.css) screen and (-webkit-min-device-pixel-ratio: 2);
<link media="screen and (-webkit-min-device-pixel-ratio: 2)" rel="stylesheet" href="example.css" /></xmp></code></blockquote>
					</div>
				</li>
			</ul>
		</div>
	</section>
	<section id="compatible" class="g-mod g-attr">
		<h2 class="tit">兼容性：</h2>
		<div class="cont">
			<ul class="support-type">
				<li><span class="support">浅绿</span> = 支持</li>
				<li><span class="unsupport">红色</span> = 不支持</li>
				<li><span class="partsupport">粉色</span> = 部分支持</li>
			</ul>
			<table class="g-data">
				<thead>
					<tr>
						<th>Values</th>
						<th>IE</th>
						<th>Firefox</th>
						<th>Chrome</th>
						<th>Safari</th>
						<th>Opera</th>
						<th>iOS Safari</th>
						<th>Android Browser</th>
						<th>Android Chrome</th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td rowspan="2"><strong>Basic Support</strong></td>
						<td class="unsupport">8.0</td>
						<td class="partsupport" rowspan="2">40.0+<sup><a href="#support1">#1</a></sup></td>
						<td class="support" rowspan="2">40.0+<sup class="fix">-webkit-</sup><sup><a href="#support2">#2</a></sup></td>
						<td class="support" rowspan="2">8.0-11.1<sup class="fix">-webkit-</sup><sup><a href="#support3">#3</a></sup></td>
						<td class="support" rowspan="2">40.0+<sup class="fix">-webkit-</sup><sup><a href="#support2">#2</a></sup></td>
						<td class="support" rowspan="2">8.0-11.3<sup class="fix">-webkit-</sup><sup><a href="#support3">#3</a></sup></td>
						<td class="support" rowspan="2">4.4+<sup class="fix">-webkit-</sup><sup><a href="#support2">#2</a></sup></td>
						<td class="support">28.0<sup class="fix">-webkit-</sup><sup><a href="#support3">#3</a></sup></td>
					</tr>
					<tr>
						<td class="partsupport">9.0+<sup><a href="#support1">#1</a></sup></td>
						<td class="support">29.0+<sup class="fix">-webkit-</sup><sup><a href="#support2">#2</a></sup></td>
					</tr>
				</tbody>
			</table>
			<ol class="support-info">
				<li id="support1">不支持非标准的<a href="../../properties/media-queries/device-pixel-ratio.htm" class="g-property">min/max-device-pixel-ratio</a>媒体查询特性，推荐使用标准特性<a href="../../properties/media-queries/resolution.htm" class="g-property">min/max-resolution</a>替代。</li>
				<li id="support2">同时支持标准的<a href="../../properties/media-queries/resolution.htm" class="g-property">min/max-resolution</a>媒体查询特性，推荐直接使用标准特性。</li>
				<li id="support3">不支持标准的<a href="../../properties/media-queries/resolution.htm" class="g-property">min/max-resolution</a>媒体查询特性。</li>
			</ol>
		</div>
	</section>
	<section id="example" class="g-mod g-attr">
		<h2 class="tit">示例：</h2>
		<div class="cont">
			<textarea cols="90" rows="10">
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="utf-8" />
<title>device-pixel-ratio of media features_CSS参考手册_web前端开发参考手册系列</title>
<meta name="author" content="Joy Du(飘零雾雨), dooyoe@gmail.com, www.doyoe.com" />
<style>
@media screen and (-webkit-min-device-pixel-ratio: 1){
	body { color: #f00; }
}
</style>
</head>
<body>
<div class="test">当你的输出设备像素密度大于或等于 1 时，本行文字显示为红色</div>
</body>
</html>
			</textarea>
			<p><input type="button" class="g-btn g-btn-sure" value="运行"></p>
		</div>
	</section>
</section>
<footer id="ft">
	<aside id="rights" class="g-mod">
		<!-- 插入浏览器及版权信息 -->
	</aside>
</footer>
<script src="../../js/jquery.js"></script>
<script src="../../js/inner.js"></script>
</body>
</html>